#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 500005;
int arr[maxn], t[maxn], N, M, a, b, c;
int lowbit(int x)
{
    //算出二进制数x从右向左出现的第一个1以及这个1之后的那些0组成数的二进制对应的十进制的数
    return x & -x;
}
void add(int x, int k)
{
    //给第x个元素加上k
    while (x <= N)
    {
        t[x] += k;
        x = x + lowbit(x); //向上传递
    }
}
int getsum(int x)
{ //arr[1...x]的求和
    int ans = 0;
    while (x >= 1)
    {
        ans += t[x];
        x = x - lowbit(x); //寻找左上节点
    }
    return ans;
}
void init()
{
    for (int i = 1; i <= N; ++i)
    {
        t[i] += arr[i];
        int j = i + lowbit(i);
        if (j <= N)
            t[j] += t[i];
    }
}
int main()
{
    cin >> N >> M;
    for (int i = 1; i <= N; ++i)
    {
        cin >> arr[i];
    }
    init();
    for (int i = 1; i <= M; ++i)
    {
        cin >> a >> b >> c;
        if (a == 1)
            add(b, c);
        if (a == 2)
            cout<< getsum(c) - getsum(b-1) << endl;
    }
    return 0;
}